<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">

<title>class RDoc::Markup::ToHtmlSnippet - rdoc: Ruby Standard Library Documentation</title>


<script src="../../js/navigation.js" defer></script>
<script src="../../js/search.js" defer></script>
<script src="../../js/search_index.js" defer></script>
<script src="../../js/searcher.js" defer></script>
<script src="../../js/darkfish.js" defer></script>

<script src="../../js/jquery-3.2.0.min.js"></script>

<script src="../../js/vue.min.js"></script>
<script src="../../js/js.cookie.min.js"></script>

<link href="../../css/fonts.css" rel="stylesheet">
<link id='rdoccss' href="../../css/rdoc.css" rel="stylesheet">
<link href="../../css/carbon17.css" rel="stylesheet">

<script type="text/javascript">
  var rdoc_rel_prefix = "../../";
  var index_rel_prefix = "../../";
  var darkModeCsseHref = "../../css/rdoc-dm.css"
  var defaultModeCssHref = "../../css/rdoc.css"
  // var cssDarkmode = Cookies.get('darkmode');
  
  if( Cookies.get("darkmode") == "true") {
	$('#rdoccss').attr("href", darkModeCsseHref);
}

//  https://cssdeck.com/blog/simple-jquery-stylesheet-switcher/

document.write('<style type="text/css">body{display:none}</style>');

</script>


</head>
<body id="top" role="document" class="class">
  <!-- this is class.html -->

  <div id='actionbar' >
    <div class='wrapper mdiv'>
      <ul class='grids g0'></ul>
    </div> 
    <!-- VERSION HEADER for 3.3.0.preview2 NOT FOUND -->
  </div> <!-- end action bar -->

  <div class='wrapper hdiv'>

    


    <nav id='vapp' role="navigation">
    <div id="project-navigation">
      <div id="home-section" role="region" title="Quick navigation" class="nav-section">
  <h2><a href="../../index.html" rel="home">Home</a></h2>

  <div id="table-of-contents-navigation"  >
    <a href="../../table_of_contents.html#pages">Pages</a>
    <a href="../../table_of_contents.html#classes">Classes</a>
    <a href="../../table_of_contents.html#methods">Methods</a>
  </div>
</div>

      <div id="search-section" role="search" class="project-section initially-hidden">
  <form action="#" method="get" accept-charset="utf-8">
    <div id="search-field-wrapper">
      <input id="search-field" role="combobox" aria-label="Search"
             aria-autocomplete="list" aria-controls="search-results"
             type="text" name="search" placeholder="Search" spellcheck="false"
             title="Type to search, Up and Down to navigate, Enter to load">
    </div>

    <ul id="search-results" aria-label="Search Results"
        aria-busy="false" aria-expanded="false"
        aria-atomic="false" class="initially-hidden"></ul>
  </form>
</div>

    </div>


    

    <button id='toggleThing' @click="toggleNav()" >Show/hide navigation</button>
    <div :class="isOpen ? 'block' : 'hidden' " id='toggleMe'>
      <div id="class-metadata">
        
        
<div id="parent-class-section" class="nav-section">
  <h3>Parent</h3>

  <p class="link"><a href="ToHtml.html">RDoc::Markup::ToHtml</a>
</div>

        
        
        
<!-- Method Quickref -->
<div id="method-list-section" class="nav-section">
  <h3>Methods</h3>

  <ul class="link-list" role="directory">
    <li class="calls-super" ><a href="#method-c-new">::new</a>
    <li ><a href="#method-i-accept_heading">#accept_heading</a>
    <li ><a href="#method-i-accept_list_item_end">#accept_list_item_end</a>
    <li ><a href="#method-i-accept_list_item_start">#accept_list_item_start</a>
    <li ><a href="#method-i-accept_list_start">#accept_list_start</a>
    <li ><a href="#method-i-accept_paragraph">#accept_paragraph</a>
    <li class="calls-super" ><a href="#method-i-accept_verbatim">#accept_verbatim</a>
    <li ><a href="#method-i-add_paragraph">#add_paragraph</a>
    <li class="calls-super" ><a href="#method-i-convert">#convert</a>
    <li ><a href="#method-i-convert_flow">#convert_flow</a>
    <li ><a href="#method-i-gen_url">#gen_url</a>
    <li ><a href="#method-i-handle_regexp_CROSSREF">#handle_regexp_CROSSREF</a>
    <li ><a href="#method-i-handle_regexp_HARD_BREAK">#handle_regexp_HARD_BREAK</a>
    <li ><a href="#method-i-html_list_name">#html_list_name</a>
    <li ><a href="#method-i-list_item_start">#list_item_start</a>
    <li class="calls-super" ><a href="#method-i-off_tags">#off_tags</a>
    <li class="calls-super" ><a href="#method-i-on_tags">#on_tags</a>
    <li class="calls-super" ><a href="#method-i-start_accepting">#start_accepting</a>
    <li ><a href="#method-i-truncate">#truncate</a>
  </ul>
</div>

      </div>
     </div>
    </nav>


    <div id='extraz'><div class='adzbox-index'  >
      
     </div>         
    </div>

    <main role="main" aria-labelledby="class-RDoc::Markup::ToHtmlSnippet">
    <h1 id="class-RDoc::Markup::ToHtmlSnippet" class="class">
      class RDoc::Markup::ToHtmlSnippet
    </h1>

    <section class="description">
    
<p>Outputs <a href="../../RDoc.html"><code>RDoc</code></a> markup as paragraphs with inline markup only.</p>

    </section>

      <section id="5Buntitled-5D" class="documentation-section">



        <section class="attribute-method-details" class="method-section">
        <header>
        <h3>Attributes</h3>
        </header>

          <div id="attribute-i-character_limit" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">character_limit</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              <p>After this many characters the input will be cut off.</p>
              </div>
            </div>
          <div id="attribute-i-mask" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">mask</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              <p>The attribute bitmask</p>
              </div>
            </div>
          <div id="attribute-i-paragraph_limit" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">paragraph_limit</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              <p>After this many paragraphs the input will be cut off.</p>
              </div>
            </div>
          <div id="attribute-i-paragraphs" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">paragraphs</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              <p>Count of paragraphs found</p>
              </div>
            </div>
            </section>


                <section id="public-class-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Class Methods</h3>
                </header>

                  <div id="method-c-new" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">new</span><span
                                class="method-args">(options, characters = 100, paragraphs = 3, markup = nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Creates a new <a href="ToHtmlSnippet.html"><code>ToHtmlSnippet</code></a> formatter that will cut off the input on the next word boundary after the given number of <code>characters</code> or <code>paragraphs</code> of text have been encountered.</p>
                                <div class="method-calls-super">
                                  Calls superclass method
                                  <a href="ToHtml.html#method-c-new"><code>RDoc::Markup::ToHtml::new</code></a>
                              </div>

                              <div class="method-source-code" id="new-source">
            <pre><span class="ruby-comment"># File rdoc/markup/to_html_snippet.rb, line 37</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span> <span class="ruby-identifier">options</span>, <span class="ruby-identifier">characters</span> = <span class="ruby-value">100</span>, <span class="ruby-identifier">paragraphs</span> = <span class="ruby-value">3</span>, <span class="ruby-identifier">markup</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-keyword">super</span> <span class="ruby-identifier">options</span>, <span class="ruby-identifier">markup</span>

  <span class="ruby-ivar">@character_limit</span> = <span class="ruby-identifier">characters</span>
  <span class="ruby-ivar">@paragraph_limit</span> = <span class="ruby-identifier">paragraphs</span>

  <span class="ruby-ivar">@characters</span> = <span class="ruby-value">0</span>
  <span class="ruby-ivar">@mask</span>       = <span class="ruby-value">0</span>
  <span class="ruby-ivar">@paragraphs</span> = <span class="ruby-value">0</span>

  <span class="ruby-ivar">@markup</span>.<span class="ruby-identifier">add_regexp_handling</span> <span class="ruby-constant">RDoc</span><span class="ruby-operator">::</span><span class="ruby-constant">CrossReference</span><span class="ruby-operator">::</span><span class="ruby-constant">CROSSREF_REGEXP</span>, <span class="ruby-value">:CROSSREF</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

                <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Instance Methods</h3>
                </header>

                  <div id="method-i-accept_heading" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">accept_heading</span><span
                                class="method-args">(heading)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Adds <code>heading</code> to the output as a paragraph</p>

                              <div class="method-source-code" id="accept_heading-source">
            <pre><span class="ruby-comment"># File rdoc/markup/to_html_snippet.rb, line 53</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">accept_heading</span> <span class="ruby-identifier">heading</span>
  <span class="ruby-ivar">@res</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;&lt;p&gt;#{to_html heading.text}\n&quot;</span>

  <span class="ruby-identifier">add_paragraph</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-accept_list_item_end" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">accept_list_item_end</span><span
                                class="method-args">(list_item)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Finishes consumption of <code>list_item</code></p>

                              <div class="method-source-code" id="accept_list_item_end-source">
            <pre><span class="ruby-comment"># File rdoc/markup/to_html_snippet.rb, line 82</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">accept_list_item_end</span> <span class="ruby-identifier">list_item</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-accept_list_item_start" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">accept_list_item_start</span><span
                                class="method-args">(list_item)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Prepares the visitor for consuming <code>list_item</code></p>

                              <div class="method-source-code" id="accept_list_item_start-source">
            <pre><span class="ruby-comment"># File rdoc/markup/to_html_snippet.rb, line 88</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">accept_list_item_start</span> <span class="ruby-identifier">list_item</span>
  <span class="ruby-ivar">@res</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">list_item_start</span>(<span class="ruby-identifier">list_item</span>, <span class="ruby-ivar">@list</span>.<span class="ruby-identifier">last</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-accept_list_start" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">accept_list_start</span><span
                                class="method-args">(list)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Prepares the visitor for consuming <code>list</code></p>

                              <div class="method-source-code" id="accept_list_start-source">
            <pre><span class="ruby-comment"># File rdoc/markup/to_html_snippet.rb, line 95</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">accept_list_start</span> <span class="ruby-identifier">list</span>
  <span class="ruby-ivar">@list</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">list</span>.<span class="ruby-identifier">type</span>
  <span class="ruby-ivar">@res</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">html_list_name</span>(<span class="ruby-identifier">list</span>.<span class="ruby-identifier">type</span>, <span class="ruby-keyword">true</span>)
  <span class="ruby-ivar">@in_list_entry</span>.<span class="ruby-identifier">push</span> <span class="ruby-string">&#39;&#39;</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-accept_paragraph" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">accept_paragraph</span><span
                                class="method-args">(paragraph)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="accept_paragraph-source">
            <pre><span class="ruby-comment"># File rdoc/markup/to_html_snippet.rb, line 69</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">accept_paragraph</span> <span class="ruby-identifier">paragraph</span>
  <span class="ruby-identifier">para</span> = <span class="ruby-ivar">@in_list_entry</span>.<span class="ruby-identifier">last</span> <span class="ruby-operator">||</span> <span class="ruby-string">&quot;&lt;p&gt;&quot;</span>

  <span class="ruby-identifier">text</span> = <span class="ruby-identifier">paragraph</span>.<span class="ruby-identifier">text</span> <span class="ruby-ivar">@hard_break</span>

  <span class="ruby-ivar">@res</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;#{para}#{to_html text}\n&quot;</span>

  <span class="ruby-identifier">add_paragraph</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-accept_verbatim" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">accept_verbatim</span><span
                                class="method-args">(verbatim)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Adds <code>verbatim</code> to the output</p>
                                <div class="method-calls-super">
                                  Calls superclass method
                                  <a href="ToHtml.html#method-i-accept_verbatim"><code>RDoc::Markup::ToHtml#accept_verbatim</code></a>
                              </div>

                              <div class="method-source-code" id="accept_verbatim-source">
            <pre><span class="ruby-comment"># File rdoc/markup/to_html_snippet.rb, line 104</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">accept_verbatim</span> <span class="ruby-identifier">verbatim</span>
  <span class="ruby-identifier">throw</span> <span class="ruby-value">:done</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@characters</span> <span class="ruby-operator">&gt;=</span> <span class="ruby-ivar">@character_limit</span>
  <span class="ruby-identifier">input</span> = <span class="ruby-identifier">verbatim</span>.<span class="ruby-identifier">text</span>.<span class="ruby-identifier">rstrip</span>

  <span class="ruby-identifier">text</span> = <span class="ruby-identifier">truncate</span> <span class="ruby-identifier">input</span>
  <span class="ruby-identifier">text</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">&#39; ...&#39;</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">text</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">input</span>

  <span class="ruby-keyword">super</span> <span class="ruby-constant">RDoc</span><span class="ruby-operator">::</span><span class="ruby-constant">Markup</span><span class="ruby-operator">::</span><span class="ruby-constant">Verbatim</span>.<span class="ruby-identifier">new</span> <span class="ruby-identifier">text</span>

  <span class="ruby-identifier">add_paragraph</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-add_paragraph" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">add_paragraph</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Throws <code>:done</code> when <a href="ToHtmlSnippet.html#attribute-i-paragraph_limit"><code>paragraph_limit</code></a> paragraphs have been encountered</p>

                              <div class="method-source-code" id="add_paragraph-source">
            <pre><span class="ruby-comment"># File rdoc/markup/to_html_snippet.rb, line 195</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">add_paragraph</span>
  <span class="ruby-ivar">@paragraphs</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>

  <span class="ruby-identifier">throw</span> <span class="ruby-value">:done</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@paragraphs</span> <span class="ruby-operator">&gt;=</span> <span class="ruby-ivar">@paragraph_limit</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-convert" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">convert</span><span
                                class="method-args">(content)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Marks up <code>content</code></p>
                                <div class="method-calls-super">
                                  Calls superclass method
                                  <a href="Formatter.html#method-i-convert"><code>RDoc::Markup::Formatter#convert</code></a>
                              </div>

                              <div class="method-source-code" id="convert-source">
            <pre><span class="ruby-comment"># File rdoc/markup/to_html_snippet.rb, line 204</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">convert</span> <span class="ruby-identifier">content</span>
  <span class="ruby-identifier">catch</span> <span class="ruby-value">:done</span> <span class="ruby-keyword">do</span>
    <span class="ruby-keyword">return</span> <span class="ruby-keyword">super</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">end_accepting</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-convert_flow" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">convert_flow</span><span
                                class="method-args">(flow)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Converts flow items <code>flow</code></p>

                              <div class="method-source-code" id="convert_flow-source">
            <pre><span class="ruby-comment"># File rdoc/markup/to_html_snippet.rb, line 215</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">convert_flow</span> <span class="ruby-identifier">flow</span>
  <span class="ruby-identifier">throw</span> <span class="ruby-value">:done</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@characters</span> <span class="ruby-operator">&gt;=</span> <span class="ruby-ivar">@character_limit</span>

  <span class="ruby-identifier">res</span> = []
  <span class="ruby-ivar">@mask</span> = <span class="ruby-value">0</span>

  <span class="ruby-identifier">flow</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">item</span><span class="ruby-operator">|</span>
    <span class="ruby-keyword">case</span> <span class="ruby-identifier">item</span>
    <span class="ruby-keyword">when</span> <span class="ruby-constant">RDoc</span><span class="ruby-operator">::</span><span class="ruby-constant">Markup</span><span class="ruby-operator">::</span><span class="ruby-constant">AttrChanger</span> <span class="ruby-keyword">then</span>
      <span class="ruby-identifier">off_tags</span> <span class="ruby-identifier">res</span>, <span class="ruby-identifier">item</span>
      <span class="ruby-identifier">on_tags</span>  <span class="ruby-identifier">res</span>, <span class="ruby-identifier">item</span>
    <span class="ruby-keyword">when</span> <span class="ruby-constant">String</span> <span class="ruby-keyword">then</span>
      <span class="ruby-identifier">text</span> = <span class="ruby-identifier">convert_string</span> <span class="ruby-identifier">item</span>
      <span class="ruby-identifier">res</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">truncate</span>(<span class="ruby-identifier">text</span>)
    <span class="ruby-keyword">when</span> <span class="ruby-constant">RDoc</span><span class="ruby-operator">::</span><span class="ruby-constant">Markup</span><span class="ruby-operator">::</span><span class="ruby-constant">RegexpHandling</span> <span class="ruby-keyword">then</span>
      <span class="ruby-identifier">text</span> = <span class="ruby-identifier">convert_regexp_handling</span> <span class="ruby-identifier">item</span>
      <span class="ruby-identifier">res</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">truncate</span>(<span class="ruby-identifier">text</span>)
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;Unknown flow element: #{item.inspect}&quot;</span>
    <span class="ruby-keyword">end</span>

    <span class="ruby-keyword">if</span> <span class="ruby-ivar">@characters</span> <span class="ruby-operator">&gt;=</span> <span class="ruby-ivar">@character_limit</span> <span class="ruby-keyword">then</span>
      <span class="ruby-identifier">off_tags</span> <span class="ruby-identifier">res</span>, <span class="ruby-constant">RDoc</span><span class="ruby-operator">::</span><span class="ruby-constant">Markup</span><span class="ruby-operator">::</span><span class="ruby-constant">AttrChanger</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">0</span>, <span class="ruby-ivar">@mask</span>)
      <span class="ruby-keyword">break</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">res</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">&#39; ...&#39;</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@characters</span> <span class="ruby-operator">&gt;=</span> <span class="ruby-ivar">@character_limit</span>

  <span class="ruby-identifier">res</span>.<span class="ruby-identifier">join</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-gen_url" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">gen_url</span><span
                                class="method-args">(url, text)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns just the text of <code>link</code>, <code>url</code> is only used to determine the link type.</p>

                              <div class="method-source-code" id="gen_url-source">
            <pre><span class="ruby-comment"># File rdoc/markup/to_html_snippet.rb, line 168</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">gen_url</span> <span class="ruby-identifier">url</span>, <span class="ruby-identifier">text</span>
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">url</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">/^rdoc-label:([^:]*)(?::(.*))?/</span> <span class="ruby-keyword">then</span>
    <span class="ruby-identifier">type</span> = <span class="ruby-string">&quot;link&quot;</span>
  <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">url</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">/([A-Za-z]+):(.*)/</span> <span class="ruby-keyword">then</span>
    <span class="ruby-identifier">type</span> = <span class="ruby-node">$1</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">type</span> = <span class="ruby-string">&quot;http&quot;</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">if</span> (<span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-string">&quot;http&quot;</span> <span class="ruby-keyword">or</span> <span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-string">&quot;https&quot;</span> <span class="ruby-keyword">or</span> <span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-string">&quot;link&quot;</span>) <span class="ruby-keyword">and</span>
     <span class="ruby-identifier">url</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">/\.(gif|png|jpg|jpeg|bmp)$/</span> <span class="ruby-keyword">then</span>
    <span class="ruby-string">&#39;&#39;</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">text</span>.<span class="ruby-identifier">sub</span>(<span class="ruby-regexp">%r%^#{type}:/*%</span>, <span class="ruby-string">&#39;&#39;</span>)
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-handle_regexp_CROSSREF" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">handle_regexp_CROSSREF</span><span
                                class="method-args">(target)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Removes escaping from the cross-references in <code>target</code></p>

                              <div class="method-source-code" id="handle_regexp_CROSSREF-source">
            <pre><span class="ruby-comment"># File rdoc/markup/to_html_snippet.rb, line 128</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">handle_regexp_CROSSREF</span> <span class="ruby-identifier">target</span>
  <span class="ruby-identifier">target</span>.<span class="ruby-identifier">text</span>.<span class="ruby-identifier">sub</span>(<span class="ruby-regexp">/\A\\/</span>, <span class="ruby-string">&#39;&#39;</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-handle_regexp_HARD_BREAK" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">handle_regexp_HARD_BREAK</span><span
                                class="method-args">(target)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p><code>target</code> is a <code>&lt;br&gt;</code></p>

                              <div class="method-source-code" id="handle_regexp_HARD_BREAK-source">
            <pre><span class="ruby-comment"># File rdoc/markup/to_html_snippet.rb, line 135</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">handle_regexp_HARD_BREAK</span> <span class="ruby-identifier">target</span>
  <span class="ruby-ivar">@characters</span> <span class="ruby-operator">-=</span> <span class="ruby-value">4</span>
  <span class="ruby-string">&#39;&lt;br&gt;&#39;</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-html_list_name" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">html_list_name</span><span
                                class="method-args">(list_type, open_tag)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>In snippets, there are no lists</p>

                              <div class="method-source-code" id="html_list_name-source">
            <pre><span class="ruby-comment"># File rdoc/markup/to_html_snippet.rb, line 188</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">html_list_name</span> <span class="ruby-identifier">list_type</span>, <span class="ruby-identifier">open_tag</span>
  <span class="ruby-string">&#39;&#39;</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-list_item_start" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">list_item_start</span><span
                                class="method-args">(list_item, list_type)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Lists are paragraphs, but notes and labels have a separator</p>

                              <div class="method-source-code" id="list_item_start-source">
            <pre><span class="ruby-comment"># File rdoc/markup/to_html_snippet.rb, line 143</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">list_item_start</span> <span class="ruby-identifier">list_item</span>, <span class="ruby-identifier">list_type</span>
  <span class="ruby-identifier">throw</span> <span class="ruby-value">:done</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@characters</span> <span class="ruby-operator">&gt;=</span> <span class="ruby-ivar">@character_limit</span>

  <span class="ruby-keyword">case</span> <span class="ruby-identifier">list_type</span>
  <span class="ruby-keyword">when</span> <span class="ruby-value">:BULLET</span>, <span class="ruby-value">:LALPHA</span>, <span class="ruby-value">:NUMBER</span>, <span class="ruby-value">:UALPHA</span> <span class="ruby-keyword">then</span>
    <span class="ruby-string">&quot;&lt;p&gt;&quot;</span>
  <span class="ruby-keyword">when</span> <span class="ruby-value">:LABEL</span>, <span class="ruby-value">:NOTE</span> <span class="ruby-keyword">then</span>
    <span class="ruby-identifier">labels</span> = <span class="ruby-constant">Array</span>(<span class="ruby-identifier">list_item</span>.<span class="ruby-identifier">label</span>).<span class="ruby-identifier">map</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">label</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">to_html</span> <span class="ruby-identifier">label</span>
    <span class="ruby-keyword">end</span>.<span class="ruby-identifier">join</span> <span class="ruby-string">&#39;, &#39;</span>

    <span class="ruby-identifier">labels</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">&quot; &amp;mdash; &quot;</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">labels</span>.<span class="ruby-identifier">empty?</span>

    <span class="ruby-identifier">start</span> = <span class="ruby-node">&quot;&lt;p&gt;#{labels}&quot;</span>
    <span class="ruby-ivar">@characters</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span> <span class="ruby-comment"># try to include the label</span>
    <span class="ruby-identifier">start</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">raise</span> <span class="ruby-constant">RDoc</span><span class="ruby-operator">::</span><span class="ruby-constant">Error</span>, <span class="ruby-node">&quot;Invalid list type: #{list_type.inspect}&quot;</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-off_tags" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">off_tags</span><span
                                class="method-args">(res, item)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Maintains a bitmask to allow HTML elements to be closed properly.  See <a href="Formatter.html"><code>RDoc::Markup::Formatter</code></a>.</p>
                                <div class="method-calls-super">
                                  Calls superclass method
                                  <a href="Formatter.html#method-i-off_tags"><code>RDoc::Markup::Formatter#off_tags</code></a>
                              </div>

                              <div class="method-source-code" id="off_tags-source">
            <pre><span class="ruby-comment"># File rdoc/markup/to_html_snippet.rb, line 261</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">off_tags</span> <span class="ruby-identifier">res</span>, <span class="ruby-identifier">item</span>
  <span class="ruby-ivar">@mask</span> <span class="ruby-operator">^=</span> <span class="ruby-identifier">item</span>.<span class="ruby-identifier">turn_off</span>

  <span class="ruby-keyword">super</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-on_tags" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">on_tags</span><span
                                class="method-args">(res, item)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Maintains a bitmask to allow HTML elements to be closed properly.  See <a href="Formatter.html"><code>RDoc::Markup::Formatter</code></a>.</p>
                                <div class="method-calls-super">
                                  Calls superclass method
                                  <a href="Formatter.html#method-i-on_tags"><code>RDoc::Markup::Formatter#on_tags</code></a>
                              </div>

                              <div class="method-source-code" id="on_tags-source">
            <pre><span class="ruby-comment"># File rdoc/markup/to_html_snippet.rb, line 251</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">on_tags</span> <span class="ruby-identifier">res</span>, <span class="ruby-identifier">item</span>
  <span class="ruby-ivar">@mask</span> <span class="ruby-operator">^=</span> <span class="ruby-identifier">item</span>.<span class="ruby-identifier">turn_on</span>

  <span class="ruby-keyword">super</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-start_accepting" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">start_accepting</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Prepares the visitor for HTML snippet generation</p>
                                <div class="method-calls-super">
                                  Calls superclass method
                                  <a href="ToHtml.html#method-i-start_accepting"><code>RDoc::Markup::ToHtml#start_accepting</code></a>
                              </div>

                              <div class="method-source-code" id="start_accepting-source">
            <pre><span class="ruby-comment"># File rdoc/markup/to_html_snippet.rb, line 119</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">start_accepting</span>
  <span class="ruby-keyword">super</span>

  <span class="ruby-ivar">@characters</span> = <span class="ruby-value">0</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-truncate" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">truncate</span><span
                                class="method-args">(text)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Truncates <code>text</code> at the end of the first word after the character_limit.</p>

                              <div class="method-source-code" id="truncate-source">
            <pre><span class="ruby-comment"># File rdoc/markup/to_html_snippet.rb, line 270</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">truncate</span> <span class="ruby-identifier">text</span>
  <span class="ruby-identifier">length</span> = <span class="ruby-identifier">text</span>.<span class="ruby-identifier">length</span>
  <span class="ruby-identifier">characters</span> = <span class="ruby-ivar">@characters</span>
  <span class="ruby-ivar">@characters</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">length</span>

  <span class="ruby-keyword">return</span> <span class="ruby-identifier">text</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@characters</span> <span class="ruby-operator">&lt;</span> <span class="ruby-ivar">@character_limit</span>

  <span class="ruby-identifier">remaining</span> = <span class="ruby-ivar">@character_limit</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">characters</span>

  <span class="ruby-identifier">text</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">/\A(.{#{remaining},}?)(\s|$)/m</span> <span class="ruby-comment"># TODO word-break instead of \s?</span>

  <span class="ruby-node">$1</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

              </section>
              </main>



            </div>  <!--  class='wrapper hdiv' -->


<footer id="validator-badges" role="contentinfo">
<p><a href="https://validator.w3.org/check/referer">Validate</a></p>
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.4.0.</p>
<p>Based on <a href="https://github.com/ged/darkfish/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.</p>

  
    <p><p><a href="https://ruby-doc.org">Ruby-doc.org</a> is provided by <a href="https://jamesbritt.com">James Britt</a> and <a href="https://neurogami.com">Neurogami</a>. </p><p><a href="https://jamesbritt.bandcamp.com/">Hack your world.  Feed your head.  Live curious</a>.</p>
</p>
  
  </footer>

<script type="text/javascript">


  let ads  = $("#carbonads-container").children().detach();


  function swapMode() {
    var cookieName = 'darkmode';
    var cssDarkmode = Cookies.get(cookieName);
    console.log("***** swapMode! " + cssDarkmode + " *****");


    if (cssDarkmode == "true") {
      console.log("We have dark mode, set the css to light ...");
      $('#rdoccss').attr("href", defaultModeCssHref);
      $('#cssSelect').text("Dark mode");
      cssDarkmode = "false";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    } else {
      console.log("We not have dark mode, set the css to dark ...");
      $('#rdoccss').attr("href", darkModeCsseHref);
      $('#cssSelect').text("Light mode");
      cssDarkmode = "true";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    }

    console.log("  --------------- ");
  }


const vueCssApp = new Vue({
el: '#menubar',
data: {
isDark: false
},
methods: {
toggleClass: function(event){
this.isDark = !this.isDark;
}
}
})

const vueApp = new Vue({
el: '#vapp',
data: { 
isOpen: true
},

mounted() {
this.handleResize();
this.manage_mob_classes();
window.addEventListener('resize', this.handleResize)
//this.isOpen !=  (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},
destroyed() {
window.removeEventListener('resize', this.handleResize)
},
created() {
//manage_mob_classes();
},

methods : {
isMobile() {
  return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},

  handleResize() {
    if (!this.isMobile()) {
      this.isOpen = window.innerWidth > 800;
    }
  },

  manage_mob_classes() {
    if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
      $("nav").addClass("mob_nav");
      $("main").addClass("mob_main");
      $("#extraz").addClass("mob_extraz");
      $("#carbonads-container").addClass("mob_carbonads-container");
      this.isOpen  = false;
    } else {
      $("nav").removeClass("mob_nav") 
        $("main").removeClass("mob_main");
      $("#extraz").removeClass("mob_extraz");
      $("#carbonads-container").removeClass("mob_carbonads-container");
      this.isOpen  = true;
    }
  },

  toggleNav() {
    this.isOpen =! this.isOpen ;
    // alert("Toggle nav!");
    console.log("toggleNav() click: " + this.isOpen );
  }
}
})

$("#carbonads-container").append(ads);


$(function() {

    var darkmode = Cookies.get("darkmode");
    console.log("Document ready: " + darkmode);

    if ( darkmode  == "true" ) {
      $('#cssSelect').text("Light mode");
    } else {
      $('#cssSelect').text("Dark mode");
     }

    $('body').css('display','block');
    });

</script>

    
  </body> 
</html>

